package com.cndw.kungfu.model.goods.app;

import java.util.Map;

import com.cndw.kungfu.config.ConstantsDayIntKey;
import com.cndw.kungfu.config.ConstantsRadio;
import com.cndw.kungfu.exception.ErrPopException;
import com.cndw.kungfu.ext.LanguageLib;
import com.cndw.kungfu.model.activity.holiday.HalloweenCore;
import com.cndw.kungfu.vo.EventNotice;

/**
 * 怪物变身卡
 * @author fantadust
 *
 */
public class AppDo132 extends AppBase {

	@Override
	public boolean check() throws Exception {

		if (player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.tbst) >=5) {
			throw new ErrPopException(LanguageLib.get("goods.use.limitday",5));
		}
		
		return true;
	}

	@Override
	public Map<String, Object> run() throws Exception {
	
		int tbs = goodsMode.getValueA();
		HalloweenCore.bsAdd(playerId, tbs);
		
		player.getDataInfo().getEveryDay().intDataAlter(ConstantsDayIntKey.tbst, 1);
		
		
		EventNotice eventNotice = new EventNotice(ConstantsRadio.comm, ConstantsRadio.commBianshen);
		eventNotice.put("uid", player.getPlayerId());
		eventNotice.put("tbs", tbs);
		eventNotice.broadcastScene(player);
		
		player.getDataInfo().commitSync();
		
		return msg;
	}

}
